<?php
    require_once('CheckoutWizard.php');
 	
    $wizard = new CheckoutWizard();
    $action = $wizard->coalesce($_GET['action']);
	
    $wizard->process($action, $_POST, $_SERVER['REQUEST_METHOD'] == 'POST');
        // only processes the form if it was posted. this way, we
        // can allow people to refresh the page without resubmitting
        // form data

?>

<html>
  <head>
    <style>
		ul.process { padding:15px 0 0 0 ; margin:0; overflow:hidden; }
		ul.process li { float:left; list-style:none; font-family:Arial, Helvetica, sans-serif; }
		ul.process li a { display:block; background:#ccc; color:#333; padding:5px 10px; border-right:#eee solid 1px; border-left:#999 solid 1px; text-decoration:none; font-size:14px; font-weight:bold; } 
		ul.process li a:hover { background:#666; color:#fff; }  
			
		ul.process li.selected a { background:#690; color:#fff; } 
		ul.process li.notselected a { float:left; list-style:none; font-family:Arial, Helvetica, sans-serif; } 
		table { font-family:Arial, Helvetica, sans-serif; font-size:13px; }
		table.steps td  { border:#eee solid 1px; }
	    td.side { background:#690; color:#fff; font-weight:bold; width:160px; }
	    th, td { padding:8px 5px; }
		th { text-align:left; }
		tr.odd { background:#eee; }
		td.alert { color:#c00; } 
    </style>

  </head>
  <body>

 	<ul class="process">
		<li class="<? echo $wizard->getStepName()=='programdetails'?'selected':'notselected';?>"><a href="">1. Program Bilgileri</a></li>
		<li class="<? echo $wizard->getStepName()=='uploadposter'?'selected':'notselected';?>"><a href="">2. Poster Yükleme</a></li>
		<li class="<? echo $wizard->getStepName()=='playlist'?'selected':'notselected';?>"><a href="">3. Playlist</a></li>
		<li class="<? echo $wizard->getStepName()=='scheduletime'?'selected':'notselected';?>"><a href="">4. Zaman Ayarı</a></li>
	</ul>
	
	<br><br>
	
    <?php if ($wizard->isComplete()) { ?>
      <p>
        Program ekledininiz...
      </p>
 
      <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>?r=program/<?= $wizard->resetAction ?>">
        <input type="submit" value="Yeniden Başla" />
		
      </form>
 
    <?php } else {  ?>
    <?php 
    
	//Yii::log($wizard->getFirstStep().'****step111**','error');
    ?>
      <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>?r=program/<?= $wizard->getStepName() ?>">
      
        <h2><?= $wizard->getStepProperty('title') ?></h2>
 
        <?php if ($wizard->getStepName() == 'programdetails') { ?>
          <table>
            <tr>
              <td>Name:</td>
              <td>
                <input type="text" name="name" value="<?= htmlSpecialChars($wizard->getValue('name')) ?>" />
              </td>
              <td>
                <?php if ($wizard->isError('name')) { ?>
                  <?= $wizard->getError('name') ?>
                <?php } ?>
              </td>
            </tr>

            <tr>
              <td>Type:</td>
              <td>
                <select name="type">
                  <option value=""></option>
                  <?php foreach ($wizard->types as $k => $v) { ?>
                    <option value="<?= $k ?>"<?php if ($wizard->getValue('type') == $k) { ?> selected="selected"<?php } ?>>
                      <?= $v ?>
                    </option>
                  <?php } ?>
                </select>
              </td>
              <td>
                <?php if ($wizard->isError('type')) { ?>
                  <?= $wizard->getError('type') ?>
                <?php } ?>
              </td>
            </tr>
          </table>
        <?php } else if ($wizard->getStepName() == 'uploadposter') { ?>
          <table>
            <tr>
              <td>Poster Dosyamız:</td>
              <td>
					
   
      			<div class="row">
    				<?php echo CHtml::beginForm(); ?> 
    				<?php echo CHtml::form('', 'post', array('enctype'=>'multipart/form-data')); ?>
                    <?php echo CHtml::label('dsfsdf', 'image'); ?>
              		<?php echo CHtml::fileField('image', '', array('id'=>'image')); ?>
              		<?php echo CHtml::submitButton('Submit'); ?> 
              		<?php echo CHtml::endForm(); ?> 
              	</div>


              </td>
              <td>
                <?php if ($wizard->isError('image')) { ?>
                  <?= $wizard->getError('image') ?>
                <?php }else {
                } ?>
              </td>
            </tr>
          </table>
        <?php } else if ($wizard->getStepName() == 'playlist') { ?>

          <p>
              Playlist Oluşturun:
	      		<?php
		      		$dataProvider=new CActiveDataProvider('Playlist');
	
					$this->widget('zii.widgets.grid.CGridView', array(
				    'dataProvider'=>$dataProvider,
				    'columns'=>array(
				        'showId',         
				        'name',  
				        'order',   
						'endpoint',   
					array(
					      'class'=>'CButtonColumn',
					      'viewButtonUrl'  =>'Yii::app()->createUrl("/playlist/view", array("id" => $data["id"]))',
					      'deleteButtonUrl'=>'Yii::app()->createUrl("/playlist/delete", array("id" =>  $data["id"]))',
					      'updateButtonUrl'=>'Yii::app()->createUrl("/playlist/update", array("id" =>  $data["id"]))',
					    ),
						        
				    ),
				));
		      		
 				?>
          </p>
 
        <?php } else if ($wizard->getStepName() == 'scheduletime') { ?>
          <p>
              Programınız için zaman dilimi seçiniz
          </p>
           <table>
            <tr>
              <td>
		 			
			         <?php 
		
			        	$this->widget('zii.widgets.jui.CJuiDatePicker', array(
		    			'name'=>'publishDate',
		    	
			
					   'options'=>array('showAnim'=>'fold',
					   'dateFormat'=>'yy-mm-dd', 
					   'hourGrid'=>5, 
					   'minuteGrid'=>10, 
					   'minDateTime'=>'js:new Date(' . date('Y,m-1,d,H,i') . ')'),  
					    
					    'htmlOptions'=>array(
					        'style'=>'height:20px;'
					    ),
						));
			         
					 ?>

			    <?php 
			    $hour_arr = array('00'=>'00', '01'=>'01', '02'=>'02', '03'=>'03','04'=>'04', '05'=>'05', '06'=>'06', '07'=>'07','08'=>'08', '09'=>'09', '10'=>'10', '11'=>'11', '12'=>'12');
			    echo CHtml::dropdownList('c_time_hour', false, $hour_arr); ?>
			    <?php echo CHtml::dropdownList('c_time_min', false,
			        array('00'=>'00', '15'=>'15', '30'=>'30', '45'=>'45')); ?>
		
			</td>
			</tr>
         </table>
        <?php } ?>
 
        <p>
          <input type="submit" 
                 name="previous" 
                 value="&lt;&lt; Önceki"<?php if ($wizard->isFirstStep()) { ?> disabled="disabled"<?php } ?> />
          <input type="submit" 
                 value="<?= $wizard->isLastStep() ? 'Tamamla' : 'Sonraki' ?> &gt;&gt;" />
                
        </p>
      </form>
    <?php } ?>
  </body>
</html>